package com.orange.adminapi.controller.employee;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.orange.core.pojo.PageReqDto;
import com.orange.core.pojo.R;
import com.orange.core.pojo.entity.employee.EmployeeCard;
import com.orange.core.pojo.req.employee.EmployeeCardPageReq;
import com.orange.core.pojo.req.employee.EmployeeCardSaveReq;
import com.orange.core.service.employee.EmployeeCardService;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 员工卡
 */
@RequiredArgsConstructor
@RestController
@RequestMapping("/employeeCard")
public class EmployeeCardController {

    private final EmployeeCardService employeeCardService;

    /**
     * 查询
     */
    @PostMapping("/page")
    public R<Page<EmployeeCard>> page(@RequestBody PageReqDto<EmployeeCardPageReq> req) {
        return R.ok(employeeCardService.page(req));
    }

    /**
     * 保存
     */
    @PostMapping("/save")
    public R<Boolean> save(@RequestBody @Validated EmployeeCardSaveReq req) {
        return R.ok(employeeCardService.save(req));
    }
}
